/**
 * Represents an element in a list
 * 
 * @author Chase Miller
 * 
 */
public class ListElement {
    
    private MyList list;
    private int element;
    
    /**
     * Construct a list element that is a number (int).
     * 
     * @param element
     */
    public ListElement(int element) {
	this.element = element;
    }
    
    /**
     * Construct an instance that contains a list.
     * 
     * @param list
     */
    public ListElement(MyList list) {
	this.list = list;
    }
    
    /**
     * Overrides the toString method.
     */
    public String toString() {
	if (this.list != null) {
	    return this.list.toString();
	} else {
	    // This list element must be of type list element
	    return String.valueOf(element);
	}
    }
}
